/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package session;

import entity.EtatCommande;
import entity.Langue;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

/**
 *
 * @author livetnediser
 */
@Stateless
public class EtatCommandeFacade extends AbstractFacade<EtatCommande> {
    @PersistenceContext(unitName = "SexyShopPU")
    private EntityManager em;

    protected EntityManager getEntityManager() {
        return em;
    }

    public EtatCommandeFacade() {
        super(EtatCommande.class);
    }

    public List<EtatCommande> getEtatsByLangue(Langue langue){
        List<EtatCommande> etats = em.createQuery("SELECT e FROM EtatCommande e WHERE e.idlangue = :langue")
        .setParameter("langue", langue)
        .getResultList();
        
        if(etats != null){
            return etats;
        }else{
            return null;
        }
    }
    
}
